package systems
{
	import flash.events.Event;
	
	/**
	 * @author Humberto Anjos
	 */
	public class Weapon
	{
		private var MAX_TIRO_COUNTER:int = 10
		
		private var _counter:int = MAX_TIRO_COUNTER
		private var _nextBulletReady:Boolean = true
		private var _nextBullet:Boolean = false
		
		public function Weapon() 
		{
			
		}
		
		public function update()
		{
			if (! _nextBulletReady) {
				_counter--
			
				if (_counter > 0) {
					return
				}
				
				_nextBulletReady = true
				_counter = MAX_TIRO_COUNTER
			}
		}
		
		public function tryToShoot():Boolean
		{
			if (_nextBulletReady) {
				_nextBulletReady = false
				_counter = MAX_TIRO_COUNTER
				
				return true
			} else {
				return false
			}
		}
	}

}